//
//  CZStatusViewModel.swift
//  weibo24
//
//  Created by 李文峰 on 16/3/6.
//  Copyright © 2016年 fengten. All rights reserved.
//

import UIKit

class CZStatusViewModel: NSObject {
    
    var statuesModel: CZStatusModel?
    

    /// 用户认证图像
    /// 认证类型 -1：没有认证，0，认证用户，2,3,5: 企业认证，220: 达人
    /// verified_type
    var verifity_image: UIImage? {
        
        
        switch statuesModel?.user?.verified_type ?? -1 {
            
        case -1: return nil
        case 0: return UIImage(named: "avatar_vip")
        case 2,3,5: return UIImage(named: "avatar_enterprise_vip")
        case 220: return UIImage(named: "avatar_grassroot")
            
            //switch语言需要加默认的 default
        default: return nil
        }
        
    }
    
    var level_image: UIImage? {
        
        //        print(statusModel?.user?.mbrank)
        //为什么是可选项的 Optional(2)
        return UIImage(named: "common_icon_membership_level\(statuesModel?.user?.mbrank ?? 0)")
        
    }
    
    //转载
    var retweetString: String? {
        if statuesModel?.reposts_count == 0{
            return "转发"
        }else{
            if let str = statuesModel?.reposts_count{
                return "\(str)"
            }
            return "转发"
        }
    }
}
